package com.xinbo.tuiyousuper.fragment.my;

import java.util.List;

import com.xinbo.tuiyousuper.R;



import com.xinbo.tuiyousuper.WebActivity;
import com.xinbo.tuiyousuper.model.fg3data.banner.Datum;
import com.xinbo.utils.UILUtils;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.ImageView;

/**
 * A simple {@link Fragment} subclass.
 *
 */
public class MyFragmentBanner_fg3 extends Fragment
{



	private List<Datum> bannerList;
	private int index;


	public MyFragmentBanner_fg3(List<Datum> bannerList, int index)
	{
		this.bannerList = bannerList;
		this.index = index;
	}


	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
	        Bundle savedInstanceState)
	{
		// Inflate the layout for this fragment
		View layout = inflater.inflate(R.layout.myfragment_banner_fg3, container,
		        false);
		ImageView mImageView = (ImageView) layout.findViewById(R.id.iv_banner_fg3);
		Datum datum = bannerList.get(index);
		if (!"".equals(datum.getPicUrl()))
        {
			UILUtils.displayImageNoAnim(datum.getPicUrl(), mImageView);
        }
		final String url = datum.getUrl();
		if (index!=0)
        {
			mImageView.setOnClickListener(new OnClickListener()
			{
				
				@Override
				public void onClick(View v)
				{
					Intent intent = new Intent();
					intent.putExtra("fg3", url);
					intent.setClass(getContext(), WebActivity.class);
					startActivityForResult(intent, 0);
				}
			});
	        
        }
		return layout;
	}

}
